/**
 * 绘制上下文定义
 */
import { Scene } from './scene';
import { GlobalElementId } from './element';

/**
 * 布局请求状态
 */
export interface RequestLayoutState {
  needsLayout: boolean;
}

/**
 * 预绘制状态
 */
export interface PrepaintState {
  parentTransform?: { x: number; y: number };
  opacity?: number;
}

/**
 * 绘制上下文，提供元素绘制所需的环境
 */
export interface PaintContext {
  window?: any;
  document?: Document;
  scene: Scene;
  fullRecreate?: boolean;
  elementId?: GlobalElementId;
  parentTransform?: { x: number; y: number };
  opacity?: number;
}

/**
 * 创建默认的绘制上下文
 */
export function createDefaultPaintContext(scene: Scene, fullRecreate: boolean = true): PaintContext {
  return {
    window: typeof window !== 'undefined' ? window : undefined,
    document: typeof document !== 'undefined' ? document : undefined,
    scene,
    fullRecreate,
    parentTransform: { x: 0, y: 0 },
    opacity: 1
  };
}